/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DBServer.java
 *
 * Created on May 4, 2012, 9:49:45 PM
 */
package Server.GUI;



import Server.BUS.*;
import Server.DTO.*;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import java.io.File;
import java.io.IOException;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.JFileChooser;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreePath;

import javax.xml.parsers.ParserConfigurationException;


/**
 *
 * @author Trung
 */
public final class DBServer extends javax.swing.JFrame {
    private JPopupMenu menuTable = new JPopupMenu("PopupTable");
    private JPopupMenu menuRoot = new JPopupMenu("PopupRoot");
    private JPopupMenu menuDatabase = new JPopupMenu("PopupDatabase");
    private JPopupMenu menuTabbedPane = new JPopupMenu("PopupTabbedPane");
    private JPopupMenu menuDesign = new JPopupMenu("PopupDesign");
    private JPopupMenu menuEdit = new JPopupMenu("PopupEdit");
    private JPopupMenu menuConfig = new JPopupMenu("PopupConfig");
    private JPopupMenu menuTableChild = new JPopupMenu("PopupTableChild");
    
    private DBServerBUS serverBUS = new DBServerBUS();
    private DatabaseBUS dbBus = new DatabaseBUS();//****
    private EditBUS editBUS = new EditBUS();
    //private QueryBUS_Tin queryBUS = new QueryBUS_Tin();
    private DatabaseInfoBUS optionBUS = new DatabaseInfoBUS();
    private DataBaseInfo dbInfo = new DataBaseInfo();    
    
    public static String path = "";    
    private String name = "";
    private String copy_cutPath = "";   
    private boolean cutCheck = false;
    
    private  File root;
    private TreePath treepath;        
    private List<Database> lstDB = new ArrayList<Database>();//*****
    private JTree tree_dir;
    
     
    /** Creates new form DBServer */
    public DBServer(){
        initComponents();
        this.dbInfo = StartForm.dbInfo;
        DBServer.path = StartForm.path;
        if(path.compareTo("") != 0){
            this.root = new File(path);//D/DB-Server        
            accessTreeFile();
        }
    }
    
    //Function access tree file
        //create root & lstDB
        //update tree file
        //create menu context of items
    public void accessTreeFile(){
        menuRoot.removeAll();
        menuTable.removeAll();
        menuDatabase.removeAll();
        menuDesign.removeAll();
        menuEdit.removeAll();
        menuTableChild.removeAll();
        menuConfig.removeAll();
        
        //this.root = new File(path);        
        final File setupFile = root;        
        
        if(!setupFile.exists()){
            setupFile.mkdir();
            
            String serverInfo = StartForm.path + "\\Server-Info";
            
            try {                
                optionBUS.saveConfig(StartForm.dbInfo, serverInfo);
            } catch (ParserConfigurationException ex) {
                Logger.getLogger(StartForm.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        
        //getAllDatabaseInfo(setupFile);
        
        // Make a tree list with all the nodes, and make it a JTree
        tree_dir = new JTree(addNodes(null, setupFile));

        // Add a listener
        tree_dir.addTreeSelectionListener(new TreeSelectionListener() {          
            @Override
            public void valueChanged(TreeSelectionEvent e) {
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.getPath().getLastPathComponent();
                System.out.println("You selected " + node);
            }
        });  
        
        //Listener mouse click and define it (Database or Table)
        tree_dir.addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e){
                if(e.getClickCount() == 2){
                    treepath = tree_dir.getClosestPathForLocation(e.getX(),e.getY());
                    
                    path = treepath.getLastPathComponent().toString();                    
                    
                    for(int i = path.length() - 1; i > 0; i--){                      
                        if(path.charAt(i) == '.'){
                            name = path.substring(i - 6);
                            if(name.compareTo("Design.xml") == 0){                                
                                TreePath tpath = treepath.getParentPath();
                                path = tpath.getLastPathComponent().toString() + "\\" + path;                               
                                
                                showCreateTableForm(dbBus.readDesignTable(path), null);
                                break;
                            }
                            
                            name = path.substring(i - 4);
                            if(name.compareTo("Edit.xml") == 0){
                                TreePath tpath = treepath.getParentPath();
                                path = tpath.getLastPathComponent().toString() + "\\" + path;                                
                                showEditTable(path);
                                break;
                            }
                        }
                        
                        if(path.contains("\\Server-Info")){
                            TreePath tpath = treepath.getParentPath();
                            path = tpath.getLastPathComponent() + "\\Server-Info";
                            showSettingForm(dbInfo);
                            break;
                        }
                    }
                } else{
                    treepath = tree_dir.getClosestPathForLocation(e.getX(),e.getY());                    
                    TreePath tpath = treepath.getParentPath();
                    path = treepath.getLastPathComponent().toString();
                    
                    if(path.compareTo("\\Server-Info") == 0){
                        path = tpath.getLastPathComponent().toString() + "\\" + treepath.getLastPathComponent().toString();
                    }else{
                        path = treepath.getLastPathComponent().toString();
                    }
                }
            }
            
            @Override
            public void mouseReleased(MouseEvent e) {                
                if (e.isPopupTrigger()) {                    
                    treepath = tree_dir.getClosestPathForLocation(e.getX(),e.getY());
                    
                    path = treepath.getLastPathComponent().toString();                    
                    
                    if(path.contains("\\Server-Info")){
                        menuConfig.show(e.getComponent(), e.getX(), e.getY());                        
                    }
                    
                    for(int i = path.length() - 1; i > 0; i--){
                        if(path.charAt(i) == '\\'){
                            name = path.substring(i + 1);
                            
                            if(name.compareTo("Tables") == 0){
                                menuTable.show(e.getComponent(), e.getX(), e.getY());
                                break;
                            } else if(name.compareTo("DB-Server") == 0){
                                menuRoot.show(e.getComponent(), e.getX(), e.getY());                        
                                break;
                            } else {
                                name = path.substring(0, i);
                                String nameChild = "";
                                for(int j = name.length() - 1; j > 0; j--){
                                    if(name.charAt(j) == '\\'){
                                        nameChild = name.substring(j + 1);
                                        if(nameChild.compareTo("Tables") == 0){
                                            menuTableChild.show(e.getComponent(), e.getX(), e.getY());    
                                            break;
                                        } else{
                                            menuDatabase.show(e.getComponent(), e.getX(), e.getY());                        
                                            break;
                                        }                                  
                                    }  
                                }                                
                                break;
                            }
                        }
                        
                        if(path.charAt(i) == '.'){
                            name = path.substring(i - 6);
                            if(name.compareTo("Design.xml") == 0){
                                name = path.substring(0, path.length() - 11);
                                TreePath tpath = treepath.getParentPath();
                                path = tpath.getLastPathComponent().toString() + "\\" + path;
                                menuDesign.show(e.getComponent(), e.getX(), e.getY());
                                break;
                            }
                            
                            name = path.substring(i - 4);
                            if(name.compareTo("Edit.xml") == 0){
                                TreePath tpath = treepath.getParentPath();
                                path = tpath.getLastPathComponent().toString() + "\\" + path;
                                menuEdit.show(e.getComponent(), e.getX(), e.getY());
                                break;
                            }
                        }
                    }
                }
            }
        });
                
        //Add a mouse listener - create context menu of Table
        final String itemsTable[] = new String[]{"New Table", "Refresh"};
        for (int i = 0; i < itemsTable.length; i++) {
            JMenuItem item = new JMenuItem(String.valueOf(itemsTable[i]));
            final String chosen = itemsTable[i];
            item.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    if(chosen.compareTo("New Table") == 0){
                        showCreateTableForm(null, path);
                    } else if(chosen.compareTo("Refresh") == 0){
                        accessTreeFile();
                    }
                }
            });
            
            menuTable.add(item);
        }
        
        //Add a mouse listener - create context menu of Design
        final String itemsFile[] = new String[]{ "Design", "Edit", "Delete", "Refresh"};
        for (int i = 0; i < itemsFile.length; i++) {
            JMenuItem item = new JMenuItem(String.valueOf(itemsFile[i]));
            final String chosen = itemsFile[i];
            item.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    if(chosen.compareTo("Design") == 0){
                        showCreateTableForm(dbBus.readDesignTable(path), null);
                    } 
                    else if(chosen.compareTo("Edit") == 0)
                    {
//                        TreePath tpath = treepath.getParentPath();
//                        path = tpath.getLastPathComponent().toString();
//                        String fileName = path + "\\" + name + "-Edit.xml";
//                        try {
//                            editBUS.saveEditTable(null, null, fileName);
//                        } catch (ParserConfigurationException ex) {
//                            Logger.getLogger(DBServer.class.getName()).log(Level.SEVERE, null, ex);
//                        }
//                        accessTreeFile();
                    } 
                    else if(chosen.compareTo("Delete") == 0){
                        serverBUS.Delete(new File(path));
                    } else if(chosen.compareTo("Refresh") == 0){
                        accessTreeFile();
                    }
                }
            });
            
            menuDesign.add(item);
        }
        
        //Add a mouse listener - create context menu of Design
        final String itemsConfig[] = new String[]{ "Edit"};
        for (int i = 0; i < itemsConfig.length; i++) {
            JMenuItem item = new JMenuItem(String.valueOf(itemsConfig[i]));
            final String chosen = itemsConfig[i];
            item.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    if(chosen.compareTo("Edit") == 0){
                       showSettingForm(dbInfo);
                    } 
                }
            });
            
            menuConfig.add(item);
        }
        
        //Add a mouse listener - create context menu of Design
        final String itemsEdit[] = new String[]{ "Edit", "Delete", "Refresh"};
        for (int i = 0; i < itemsEdit.length; i++) {
            JMenuItem item = new JMenuItem(String.valueOf(itemsEdit[i]));
            final String chosen = itemsEdit[i];
            item.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    if(chosen.compareTo("Edit") == 0){
                        showEditTable(path);
                    } else if(chosen.compareTo("Delete") == 0){
                        serverBUS.Delete(new File(path));
                    } else if(chosen.compareTo("Refresh") == 0){
                        accessTreeFile();
                    }
                }
            });
            
            menuEdit.add(item);
        }
        
        //Add a mouse listener - create context menu of Design
        final String itemsTableChild[] = new String[]{ "Delete", "Refresh"};
        for (int i = 0; i < itemsTableChild.length; i++) {
            JMenuItem item = new JMenuItem(String.valueOf(itemsTableChild[i]));
            final String chosen = itemsTableChild[i];
            item.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    if(chosen.compareTo("Delete") == 0){
                        serverBUS.Delete(new File(path));
                    } else if(chosen.compareTo("Refresh") == 0){
                        accessTreeFile();
                    }
                }
            });
            
            menuTableChild.add(item);
        }
        
        //Add a mouse listener - create context menu of Database
        final String itemsRoot[] = new String[]{"New Database", "Refresh"};
        for (int i = 0; i < itemsRoot.length; i++) {
            JMenuItem item = new JMenuItem(String.valueOf(itemsRoot[i]));
            final String chosen = itemsRoot[i];
            item.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {                    
                    if(chosen.compareTo("New Database") == 0){
                        if(createDatabase(path))
                            System.out.println("Create database success!");
                        else
                            System.out.println("Database existed");
                    }else if(chosen.compareTo("Refresh") == 0){
                        accessTreeFile();
                    }
                }
            });
            
            menuRoot.add(item);
        }
        
        //Add a mouse listener - create context menu of Database
        final String itemsDatabase[] = new String[]{"Delete", "Import", "Export", "Refresh"};
        for (int i = 0; i < itemsDatabase.length; i++) {
            JMenuItem item = new JMenuItem(String.valueOf(itemsDatabase[i]));
            final String chosen = itemsDatabase[i];
            item.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {                    
                    if(chosen.compareTo("Delete") == 0){
                        File dirFile = new File(path);
                        serverBUS.Delete(dirFile);                        
                    }else if(chosen.compareTo("Import") == 0){
                        
                    } else if(chosen.compareTo("Export") == 0){
                        
                    } else if(chosen.compareTo("Refresh") == 0){
                        accessTreeFile();
                    }
                }
            });
            
            menuDatabase.add(item);
        }

        //Set tree file into panel to show
        treepane.getViewport().add(tree_dir); 
    }
    
//   public void openQueryFile(){
//        menuTabbedPane.removeAll();
//        Query query = new Query();
//
//        JFileChooser fc = new JFileChooser();    
//        int returnVal = fc.showOpenDialog(this);
//        if (returnVal == JFileChooser.APPROVE_OPTION) {  
//            String s = fc.getSelectedFile().toString();
//            query = queryBUS.readQueryFile(s);
//
//            NewQuery queryForm = new NewQuery(query, lstDB, tabpane);        
//            tabpane.addTab("New Query", queryForm);  
//
//            setTab();           
//        }
//    }
    
    public void openDatabase(){        
        JFileChooser fc = new JFileChooser();
        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        fc.setAcceptAllFileFilterUsed(false);
                      
        int returnVal = fc.showOpenDialog(this);

        if (returnVal == JFileChooser.APPROVE_OPTION) {            
            root = fc.getCurrentDirectory();
            
            if(root.getPath().contains("DB-Server")){
                accessTreeFile();
            }else{
                JOptionPane.showMessageDialog(null, "You must choose \"DB-Server\" folder!");
            }            
        }        
    }
    
    //Get all db from Root directory
    public void getAllDatabaseInfo(File root){//******
        lstDB.clear();
        
        for(File databaseFile : root.listFiles()){
            if(databaseFile.isDirectory())
            {
                Database databaseDTO = new Database();  
                List<Table> tableList = new ArrayList<Table>();

                databaseDTO.setName(databaseFile.getName());
                databaseDTO.setPath(databaseFile.getPath());

                File file = new File(databaseFile.getPath() + "\\Tables");            
                for(File tableFile : file.listFiles()){
                    Table tableDTO = new Table();
                    //tableDTO.setName(tableFile.getName());
                    String namePath = tableFile.getPath() + "\\" + tableFile.getName() + ".xml";//-Design
                    tableDTO = dbBus.readDesignTable(namePath);//****

                    tableList.add(tableDTO);
                }      
                databaseDTO.setTables(tableList);
                lstDB.add(databaseDTO);
            }
        }
    }
    
    public boolean createDatabase(String path) {
        String dbName = JOptionPane.showInputDialog(this, "Database name:", "New Database", 1);
        //create lstDB
        File dbFile = new File(path + "\\" + dbName);
        if (dbFile.exists()) 
        {
            return false;
        } 
        else 
        {
            dbFile.mkdir();

            //create tablepane
            File tables = new File(path + "\\" + dbName + "\\" + "Tables");
            tables.mkdir();
            return true;
        }
    }
    
    public void showSettingForm(DataBaseInfo config){
        menuTabbedPane.removeAll();
        SettingForm optionpane;
        
        optionpane = new SettingForm(config, path, tabpane);
        tabpane.addTab("Option", optionpane);  
               
        setTab();
    }
    
    public void showCreateTableForm(Table table, String filepath){
        menuTabbedPane.removeAll();
        CreateTablesForm tablepane;
        if(table != null){ //show tableList exist
            tablepane = new CreateTablesForm(tabpane, path, table, lb_status);
            tabpane.addTab("Design Table", tablepane);  
        } else { //create tableList
            tablepane = new CreateTablesForm(tabpane, filepath, lb_status);
            tabpane.addTab("Design Table", tablepane);  
        }
        
        setTab();
    }

    public void showEditTable(String editPath){ 
     /*   String designPath = getDesignPath(editPath);
        menuTabbedPane.removeAll();
        EditTables tablepane;
        
       
        tablepane = new EditTables(tabpane, editPath, designPath, lb_status);
       tabpane.addTab("Edit Table", tablepane);  
       
        
        tabpane.addMouseListener(new MouseAdapter() {
           @Override
           public void mouseReleased(MouseEvent e) {                
                if (e.isPopupTrigger()) {                    
                    menuTabbedPane.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        });
        
        //Add a mouse listener - create context menu of Tab
        final String itemsDatabase[] = new String[]{"Close this tab", "Close all tab"};
        for (int i = 0; i < itemsDatabase.length; i++) {
            JMenuItem item = new JMenuItem(String.valueOf(itemsDatabase[i]));
            final String chosen = itemsDatabase[i];
            item.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {                    
                    if(chosen.compareTo("Close this tab") == 0){
                        tabpane.remove(tabpane.getSelectedIndex());
                    } else if(chosen.compareTo("Close all tab") == 0){
                        ///close all tab
                   }
                }
            });
            
            menuTabbedPane.add(item);
        }
        * */
        
    }
    
    public String getDesignPath(String path){
        String designPath = "";
        
        for(int i = path.length() - 1; i > 0; i--){
            if(path.charAt(i) == '-'){
                designPath = path.substring(0, i) + ".xml";//-Design
                break;
            }
        }        
        return designPath;
    }

    /** Add nodes from under "dir" into curTop. Highly recursive. */
    DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir) {
        String curPath = dir.getPath();
        DefaultMutableTreeNode curDir = new DefaultMutableTreeNode(curPath);
        
        if (curTop != null) { // should only be null at root
            curTop.add(curDir);
        }
        
        Vector ol = new Vector();
        String[] tmp = dir.list();
        
        for (int i = 0; i < tmp.length; i++){
            ol.addElement(tmp[i]);
        }
        
        Collections.sort(ol, String.CASE_INSENSITIVE_ORDER);
        File f;
        Vector files = new Vector();
        
        // Make two passes, one for Dirs and one for Files. This is #1.
        for (int i = 0; i < ol.size(); i++) {
            String thisObject = (String) ol.elementAt(i);
            String newPath;
            
            if (curPath.equals(".")){
                newPath = thisObject;
            } else {
                newPath = curPath + File.separator + thisObject;
            }
            
            if ((f = new File(newPath)).isDirectory()){
                addNodes(curDir, f);
            } else {
                files.addElement(thisObject);
            }
        }
        // Pass two: for files.
        for (int fnum = 0; fnum < files.size(); fnum++){
            curDir.add(new DefaultMutableTreeNode(files.elementAt(fnum)));
        }
        
        return curDir;
    }
    
    public void setTab(){
        tabpane.addMouseListener(new MouseAdapter() {
        @Override
            public void mouseReleased(MouseEvent e) {             
                if (e.isPopupTrigger()) {                    
                    menuTabbedPane.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        });

        //Add a mouse listener - create context menu of Tab
        final String itemsDatabase[] = new String[]{"Close this tab", "Close all tab"};
        for (int i = 0; i < itemsDatabase.length; i++) {
            JMenuItem item = new JMenuItem(String.valueOf(itemsDatabase[i]));
            final String chosen = itemsDatabase[i];
            item.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {                    
                    if(chosen.compareTo("Close this tab") == 0){
                        tabpane.remove(tabpane.getSelectedIndex());
                    } else if(chosen.compareTo("Close all tab") == 0){
                        ///close all tab
                    }
                }
            });

            menuTabbedPane.add(item);
        }
    }
    
    public void save(int index){
       /*String tilte = tabpane.getTitleAt(index);
    
        if(tilte.compareTo("New Query") == 0){
            NewQuery newQuery = null;
            newQuery = (NewQuery)tabpane.getComponentAt(index);
           newQuery.save();
       }

        if(tilte.compareTo("Edit Table") == 0){
            EditTables editTable = null;
            editTable = (EditTables)tabpane.getComponentAt(index);
            editTable.save();
       }

       if(tilte.compareTo("Design Table") == 0){
            CreateTablesForm designTable = null;
            designTable = (CreateTablesForm)tabpane.getComponentAt(index);
            designTable.save();
        }
        * */
        
    }
    
    public void saveAll(){
        for(int i = 0; i < tabpane.getTabCount(); i++){
            save(i);
        }
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuItem1 = new javax.swing.JMenuItem();
        jSplitPane1 = new javax.swing.JSplitPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        treepane = new javax.swing.JScrollPane();
        bt_refresh2 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        tabpane = new javax.swing.JTabbedPane();
        lb_status = new javax.swing.JLabel();
        jToolBar1 = new javax.swing.JToolBar();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        bt_newquery = new javax.swing.JButton();
        bt_open = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JToolBar.Separator();
        bt_delete = new javax.swing.JButton();
        bt_refresh1 = new javax.swing.JButton();
        bt_excute = new javax.swing.JButton();
        bt_CreatSocket = new javax.swing.JButton();
        menubar = new javax.swing.JMenuBar();
        mn_file = new javax.swing.JMenu();
        mni_connect = new javax.swing.JMenuItem();
        mni_disconnect = new javax.swing.JMenuItem();
        mn_new = new javax.swing.JMenu();
        mni_database = new javax.swing.JMenuItem();
        mni_query = new javax.swing.JMenuItem();
        mn_open = new javax.swing.JMenu();
        mni_opendatabase = new javax.swing.JMenuItem();
        mni_openquery = new javax.swing.JMenuItem();
        mni_exit = new javax.swing.JMenuItem();
        mn_edit = new javax.swing.JMenu();
        mni_cut = new javax.swing.JMenuItem();
        mni_copy = new javax.swing.JMenuItem();
        mni_paste = new javax.swing.JMenuItem();
        mn_query = new javax.swing.JMenu();
        mni_execute = new javax.swing.JMenuItem();
        mn_tool = new javax.swing.JMenu();
        mni_resfresh = new javax.swing.JMenuItem();
        mni_option = new javax.swing.JMenuItem();
        mn_helps = new javax.swing.JMenu();
        mni_About = new javax.swing.JMenuItem();

        jMenuItem1.setText("jMenuItem1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("DB-Server");

        jSplitPane1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jSplitPane1.setDividerLocation(250);
        jSplitPane1.setDividerSize(6);

        jLabel1.setText("Object Explorer");

        bt_refresh2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/refresh.png"))); // NOI18N
        bt_refresh2.setRequestFocusEnabled(false);
        bt_refresh2.setRolloverEnabled(false);
        bt_refresh2.setVerifyInputWhenFocusTarget(false);
        bt_refresh2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_refresh2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 150, Short.MAX_VALUE)
                .addComponent(bt_refresh2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(treepane)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(bt_refresh2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(treepane, javax.swing.GroupLayout.DEFAULT_SIZE, 359, Short.MAX_VALUE))
        );

        jSplitPane1.setLeftComponent(jPanel1);

        tabpane.setPreferredSize(new java.awt.Dimension(10, 5));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tabpane, javax.swing.GroupLayout.DEFAULT_SIZE, 527, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabpane, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)
        );

        jSplitPane1.setRightComponent(jPanel2);

        lb_status.setText("Status");

        jToolBar1.setRollover(true);
        jToolBar1.setMaximumSize(new java.awt.Dimension(80, 32769));
        jToolBar1.setMinimumSize(new java.awt.Dimension(500, 500));
        jToolBar1.setPreferredSize(new java.awt.Dimension(500, 500));
        jToolBar1.add(jSeparator1);

        bt_newquery.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Server/GUI/Image/Noname.gif"))); // NOI18N
        bt_newquery.setToolTipText("New Query");
        bt_newquery.setFocusable(false);
        bt_newquery.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        bt_newquery.setMaximumSize(new java.awt.Dimension(48, 46));
        bt_newquery.setMinimumSize(new java.awt.Dimension(48, 46));
        bt_newquery.setPreferredSize(new java.awt.Dimension(48, 46));
        bt_newquery.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_newqueryActionPerformed(evt);
            }
        });
        jToolBar1.add(bt_newquery);

        bt_open.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Server/GUI/Image/Noname2.gif"))); // NOI18N
        bt_open.setToolTipText("Open");
        bt_open.setFocusable(false);
        bt_open.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        bt_open.setMaximumSize(new java.awt.Dimension(48, 46));
        bt_open.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        bt_open.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_openActionPerformed(evt);
            }
        });
        jToolBar1.add(bt_open);
        jToolBar1.add(jSeparator2);

        bt_delete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Server/GUI/Image/Noname (2).gif"))); // NOI18N
        bt_delete.setToolTipText("Delete");
        bt_delete.setFocusable(false);
        bt_delete.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        bt_delete.setMaximumSize(new java.awt.Dimension(58, 46));
        bt_delete.setMinimumSize(new java.awt.Dimension(48, 46));
        bt_delete.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        bt_delete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_deleteActionPerformed(evt);
            }
        });
        jToolBar1.add(bt_delete);

        bt_refresh1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Server/GUI/Image/dep_6115441-Refresh-3d-button..jpg"))); // NOI18N
        bt_refresh1.setToolTipText("Refresh");
        bt_refresh1.setFocusable(false);
        bt_refresh1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        bt_refresh1.setMaximumSize(new java.awt.Dimension(48, 46));
        bt_refresh1.setMinimumSize(new java.awt.Dimension(48, 46));
        bt_refresh1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        bt_refresh1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_refresh1ActionPerformed(evt);
            }
        });
        jToolBar1.add(bt_refresh1);

        bt_excute.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Server/GUI/Image/th_start_button.png"))); // NOI18N
        bt_excute.setToolTipText("Execute");
        bt_excute.setFocusable(false);
        bt_excute.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        bt_excute.setMaximumSize(new java.awt.Dimension(58, 46));
        bt_excute.setMinimumSize(new java.awt.Dimension(48, 46));
        bt_excute.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        bt_excute.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_excuteActionPerformed(evt);
            }
        });
        jToolBar1.add(bt_excute);

        bt_CreatSocket.setText("Create Socket");
        bt_CreatSocket.setFocusable(false);
        bt_CreatSocket.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        bt_CreatSocket.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        bt_CreatSocket.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_CreatSocketActionPerformed(evt);
            }
        });
        jToolBar1.add(bt_CreatSocket);

        menubar.setAlignmentX(1.0F);

        mn_file.setText("File");

        mni_connect.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/connect.png"))); // NOI18N
        mni_connect.setText("Connect");
        mni_connect.setToolTipText("Connect to database");
        mn_file.add(mni_connect);

        mni_disconnect.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/disconnect.png"))); // NOI18N
        mni_disconnect.setText("Disconnect");
        mni_disconnect.setToolTipText("Disconnect");
        mn_file.add(mni_disconnect);

        mn_new.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/new.png"))); // NOI18N
        mn_new.setText("New");
        mn_new.setToolTipText("New object");

        mni_database.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.CTRL_MASK));
        mni_database.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/database.png"))); // NOI18N
        mni_database.setText("Database");
        mni_database.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_databaseActionPerformed(evt);
            }
        });
        mn_new.add(mni_database);

        mni_query.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK));
        mni_query.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/query.png"))); // NOI18N
        mni_query.setText("SQL Query");
        mni_query.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_queryActionPerformed(evt);
            }
        });
        mn_new.add(mni_query);

        mn_file.add(mn_new);

        mn_open.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/open.png"))); // NOI18N
        mn_open.setText("Open");
        mn_open.setToolTipText("Open Database or SQL-Query");

        mni_opendatabase.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/database.png"))); // NOI18N
        mni_opendatabase.setText("Database");
        mni_opendatabase.setToolTipText("Open Database");
        mni_opendatabase.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_opendatabaseActionPerformed(evt);
            }
        });
        mn_open.add(mni_opendatabase);

        mni_openquery.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/query.png"))); // NOI18N
        mni_openquery.setText("SQL-Query File");
        mni_openquery.setToolTipText("Open SQL-Query file");
        mni_openquery.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_openqueryActionPerformed(evt);
            }
        });
        mn_open.add(mni_openquery);

        mn_file.add(mn_open);

        mni_exit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
        mni_exit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/exit.png"))); // NOI18N
        mni_exit.setText("Exit");
        mni_exit.setToolTipText("Exit program");
        mni_exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_exitActionPerformed(evt);
            }
        });
        mn_file.add(mni_exit);

        menubar.add(mn_file);

        mn_edit.setText("Edit");

        mni_cut.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
        mni_cut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/cut.png"))); // NOI18N
        mni_cut.setText("Cut");
        mni_cut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_cutActionPerformed(evt);
            }
        });
        mn_edit.add(mni_cut);

        mni_copy.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        mni_copy.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/copy.png"))); // NOI18N
        mni_copy.setText("Copy");
        mni_copy.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_copyActionPerformed(evt);
            }
        });
        mn_edit.add(mni_copy);

        mni_paste.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
        mni_paste.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/paste.png"))); // NOI18N
        mni_paste.setText("Paste");
        mni_paste.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_pasteActionPerformed(evt);
            }
        });
        mn_edit.add(mni_paste);

        menubar.add(mn_edit);

        mn_query.setText("Query");

        mni_execute.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, java.awt.event.InputEvent.CTRL_MASK));
        mni_execute.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/start.png"))); // NOI18N
        mni_execute.setText("Excute");
        mni_execute.setToolTipText("Execute query");
        mni_execute.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_executeActionPerformed(evt);
            }
        });
        mn_query.add(mni_execute);

        menubar.add(mn_query);

        mn_tool.setText("Tools");
        mn_tool.setToolTipText("");

        mni_resfresh.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
        mni_resfresh.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/refresh.png"))); // NOI18N
        mni_resfresh.setText("Refresh");
        mni_resfresh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_resfreshActionPerformed(evt);
            }
        });
        mn_tool.add(mni_resfresh);

        mni_option.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/setting.png"))); // NOI18N
        mni_option.setText("Option");
        mni_option.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_optionActionPerformed(evt);
            }
        });
        mn_tool.add(mni_option);

        menubar.add(mn_tool);

        mn_helps.setText("Help");

        mni_About.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/about.png"))); // NOI18N
        mni_About.setText("About");
        mni_About.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_AboutActionPerformed(evt);
            }
        });
        mn_helps.add(mni_About);

        menubar.add(mn_helps);

        setJMenuBar(menubar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(lb_status, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(10, 10, 10))
            .addComponent(jSplitPane1)
            .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSplitPane1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lb_status, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void bt_refresh2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_refresh2ActionPerformed
// TODO add your handling code here:
    accessTreeFile();
}//GEN-LAST:event_bt_refresh2ActionPerformed

private void bt_refresh1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_refresh1ActionPerformed
// TODO add your handling code here:
    accessTreeFile();
}//GEN-LAST:event_bt_refresh1ActionPerformed

private void bt_newqueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_newqueryActionPerformed
// TODO add your handling code here:
    menuTabbedPane.removeAll();
    this.getAllDatabaseInfo(root);
    QueryForm queryForm = new QueryForm(lstDB, tabpane);

    //tablepane = new EditTables(tabpane, editPath, designPath);
    tabpane.addTab("New Query", queryForm);  

    setTab();    
}//GEN-LAST:event_bt_newqueryActionPerformed

private void mni_queryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_queryActionPerformed
// TODO add your handling code here:
    menuTabbedPane.removeAll();
    this.getAllDatabaseInfo(root);
    QueryForm queryForm = new QueryForm(lstDB, tabpane);

    //tablepane = new EditTables(tabpane, editPath, designPath);
    tabpane.addTab("New Query", queryForm);  

    setTab();
}//GEN-LAST:event_mni_queryActionPerformed

private void bt_excuteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_excuteActionPerformed
// TODO add your handling code here:
    QueryForm queryForm = null;
    queryForm = (QueryForm)tabpane.getSelectedComponent();
    queryForm.execute();
}//GEN-LAST:event_bt_excuteActionPerformed

private void mni_exitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_exitActionPerformed
// TODO add your handling code here:
    this.dispose();
    System.exit(0);
}//GEN-LAST:event_mni_exitActionPerformed

private void mni_executeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_executeActionPerformed
// TODO add your handling code here:
    QueryForm queryForm = null;
    queryForm = (QueryForm)tabpane.getSelectedComponent();
    queryForm.execute();
}//GEN-LAST:event_mni_executeActionPerformed

private void mni_resfreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_resfreshActionPerformed
// TODO add your handling code here:
    accessTreeFile();
}//GEN-LAST:event_mni_resfreshActionPerformed

private void mni_databaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_databaseActionPerformed
// TODO add your handling code here:
    if(createDatabase(path))
        System.out.println("Create Database success!");
    else
        System.out.println("Database existed");
                
}//GEN-LAST:event_mni_databaseActionPerformed

private void bt_openActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_openActionPerformed
// TODO add your handling code here:
//    String messages = "Do you want to open Database?\n      Yes: Open Database\n      No: Open SQL-Query File";
//    int confirm = JOptionPane.showConfirmDialog(null, messages);
//    
//    switch(confirm){
//        case JOptionPane.NO_OPTION:
//            openQueryFile();
//            break;
//        case JOptionPane.YES_OPTION:
//            openDatabase();
//            break;
//    }
     NhapLieu.main(null);
}//GEN-LAST:event_bt_openActionPerformed

private void mni_opendatabaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_opendatabaseActionPerformed
// TODO add your handling code here:
    openDatabase();
}//GEN-LAST:event_mni_opendatabaseActionPerformed

private void mni_openqueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_openqueryActionPerformed
// TODO add your handling code here:
    //openQueryFile();
}//GEN-LAST:event_mni_openqueryActionPerformed

private void mni_copyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_copyActionPerformed
// TODO add your handling code here:
    copy_cutPath = path;    
    cutCheck = false;
}//GEN-LAST:event_mni_copyActionPerformed

private void mni_cutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_cutActionPerformed
// TODO add your handling code here:
    copy_cutPath = path;
    cutCheck = true;    
}//GEN-LAST:event_mni_cutActionPerformed

private void mni_pasteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_pasteActionPerformed
// TODO add your handling code here:
    String paste = path;
    File src = new File(copy_cutPath);
    File dst = new File(paste);
    
    if(src.exists() && dst.exists()){
        try {
            serverBUS.copy(src, dst);
        } catch (IOException ex) {
            Logger.getLogger(DBServer.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        if(cutCheck){
            serverBUS.Delete(src);
        }
    }
    
    
}//GEN-LAST:event_mni_pasteActionPerformed

private void mni_optionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_optionActionPerformed
// TODO add your handling code here:
    showSettingForm(dbInfo);
}//GEN-LAST:event_mni_optionActionPerformed

    private void bt_CreatSocketActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_CreatSocketActionPerformed
        // TODO add your handling code here:
        new SocketForm().main(null);
    }//GEN-LAST:event_bt_CreatSocketActionPerformed

    private void mni_AboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_AboutActionPerformed
        // TODO add your handling code here:
        About.main(null);
    }//GEN-LAST:event_mni_AboutActionPerformed

    private void bt_deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_deleteActionPerformed
// TODO add your handling code here:    
        serverBUS.Delete(new File(path));
    }//GEN-LAST:event_bt_deleteActionPerformed


    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(DBServer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(DBServer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(DBServer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(DBServer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new DBServer().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bt_CreatSocket;
    private javax.swing.JButton bt_delete;
    private javax.swing.JButton bt_excute;
    private javax.swing.JButton bt_newquery;
    private javax.swing.JButton bt_open;
    private javax.swing.JButton bt_refresh1;
    private javax.swing.JButton bt_refresh2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JToolBar.Separator jSeparator2;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JLabel lb_status;
    private javax.swing.JMenuBar menubar;
    private javax.swing.JMenu mn_edit;
    private javax.swing.JMenu mn_file;
    private javax.swing.JMenu mn_helps;
    private javax.swing.JMenu mn_new;
    private javax.swing.JMenu mn_open;
    private javax.swing.JMenu mn_query;
    private javax.swing.JMenu mn_tool;
    private javax.swing.JMenuItem mni_About;
    private javax.swing.JMenuItem mni_connect;
    private javax.swing.JMenuItem mni_copy;
    private javax.swing.JMenuItem mni_cut;
    private javax.swing.JMenuItem mni_database;
    private javax.swing.JMenuItem mni_disconnect;
    private javax.swing.JMenuItem mni_execute;
    private javax.swing.JMenuItem mni_exit;
    private javax.swing.JMenuItem mni_opendatabase;
    private javax.swing.JMenuItem mni_openquery;
    private javax.swing.JMenuItem mni_option;
    private javax.swing.JMenuItem mni_paste;
    private javax.swing.JMenuItem mni_query;
    private javax.swing.JMenuItem mni_resfresh;
    private javax.swing.JTabbedPane tabpane;
    private javax.swing.JScrollPane treepane;
    // End of variables declaration//GEN-END:variables
}

